import { POST_APP_DATA, CHANGE_FIELD_DATA } from '../../constants/ActionType';
import * as APIS from '../../constants/APIS';
import { fetchPOST } from '../../utils/index';


export function postUploadData(data) {
    console.log('data', data);
    return dispatch => {
        fetchPOST(APIS.POST_APP_DATA_INTO_DB, data)
            .then((res) => {
                console.log(res);
                dispatch({ type: POST_APP_DATA, payload: {} })
            })
    }
}

export function changeFieldData(fieldName, fieldValue) {
    return dispatch => {
        dispatch({ type: CHANGE_FIELD_DATA, payload: {fieldName, fieldValue}});
    }
}